<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<tiles:insertDefinition name="defaultTemplate">
	<tiles:putAttribute name="body">

	<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/roleMenuMapping.js"></script>
	<script type="text/javascript">$(document).ready(function() {dataTable('${oLanguage}','${pageContext.request.contextPath}')});</script>

		<div class="body">
				<div class="panel-heading">		
					<h4 class="fadeInUp animation-delay5" style="font-weight:bold">
					<span class="text-success">Role </span> <span style="color:#ccc; text-shadow:0 1px #fff"> MenuMapping</span>
					</h4>
				</div>	
				<form:form method="POST" modelAttribute="roleMenu" >		
					<div class="row form-group" style="margin-top: 3%;">
					<div class="col-sm-4"></div>
					<input type="hidden" id="vaSiteId" name="vaSiteId" value="${vaSiteId }" />
					<input type="hidden" id="processType" name="processType" value="insertRole" />
					<input type="hidden" id="paApplicationId" name="paApplicationId" value="${vaAppChecked}" />
					<input type="hidden" id="paMenuIdChecked" name="paMenuIdChecked" value="" />
					<label for="" class="col-sm-1"><spring:message code="label.roleMenu.field.id" /></label>
						<div class="col-sm-3">
							<input id="vaRoleId" name="vaRoleId" type="text" placeholder="Role Id" maxlength="2" value="${vaRoleId }"  readonly="readonly"  class="form-control input-sm" data-required="true"/>
						</div>
					</div>
					<!-- /form-group -->
					<div class="row form-group">
					<div class="col-sm-4"></div>
					<label class="col-sm-1"><spring:message code="label.roleMenu.field.name" /></label>
						<div class="col-sm-3">
							<input  id="vaRoleName" name="vaRoleName" type="text" placeholder="Role Name" value="${vaRoleName}" readonly="readonly"  maxlength="200" class="form-control input-sm" data-required="true" />
						</div>
					</div> 	
					<br/><br/>
					<div class="col-sm-2" style="margin-right: 41.6%;;"></div>
					<label for="" class="col-sm-1" style="text-align: right"> Application </label>
						<div class="col-sm-4">
							<select class="form-control input-sm" name="vaAppId" id="vaAppId" onchange="directToRoleMenu();"> 
								<c:forEach items="${applicationList }" var="applicationList">
									<option value="${applicationList.vaApplicationId }"> ${applicationList.vaApplicationId } ${applicationList.vaApplicationName }</option>
								</c:forEach>
							</select>
						</div>
					<!-- /form-group -->
				<!-- Data Table -->	
								
					<table style="width: 99%;margin-top: 3%;">
						<tr>
							<td>
				
					<table id="roleMenuData" class="display"  class="table table-striped" style="width: 99%;margin-top: 3%;">
						<thead>
							<tr>
								<th>
									<label class="label-checkbox">
										<input type="checkbox" name="checkAll" id="checkAll">
										<span class="custom-checkbox info"></span>
									</label>
								</th>
								<th><spring:message	code="label.roleMenu.field.menuId" /></th>
								<th><spring:message	code="label.roleMenu.field.menuNameTH" /></th>
								<th><spring:message	code="label.roleMenu.field.menuNameEN" /></th>
								<th><spring:message	code="label.roleMenu.field.menuUrl" /></th>
								<th><spring:message	code="label.roleMenu.field.create" /></th>
								<th><spring:message	code="label.roleMenu.field.read" /></th>
								<th><spring:message	code="label.roleMenu.field.update" /></th>
								<th><spring:message	code="label.roleMenu.field.delete" /></th>
							</tr>
						</thead>							
					</table>
					
							</td>
						</tr>
					</table>
					
					<div class="row form-group" style="margin-top: 1%;">
						<div class="col-sm-12">
							<div class="col-sm-7 text-right">
							<button type="button" onclick="window.location.href='../jAuthen/role'" class="btn btn-default btn-sm"><i class="fa fa-chevron-left"></i> <spring:message code="label.roleApp.button.back" /> </button>	
							<button type="submit"  class="btn btn-success btn-sm"><i class="fa fa-save"></i> <spring:message code="label.roleApp.button.save" /> </button>&nbsp;
							</div>
						</div>
					</div> 	
				<!-- /form-group -->				
				</form:form>
		</div>
	</tiles:putAttribute>
</tiles:insertDefinition>
</body>
</html>